package cc.rengu.redp.flowable.listener.test;

import cc.rengu.redp.flowable.listener.AbstractBizListener;
import cc.rengu.redp.flowable.listener.EventInfo;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.flowable.common.engine.api.delegate.Expression;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class BizTestBizListener extends AbstractBizListener {

    /**
     * 在配置中注入该值
     */
    private Expression listenerData;

    @Override
    public JSONObject doExecute(JSONObject flowData, EventInfo eventInfo) {
        log.info("BizTestBizListener test！");
        if (listenerData != null) {
            flowData.put("listenerData", listenerData.getExpressionText());
        }
        return flowData;
    }

    @Override
    public String simpleDescription() {
        return "测试监听处理器";
    }
}
